package com.aoip.telemetry.telemetry.quartz.task.ReportStatistics;

import com.aoip.telemetry.telemetry.quartz.task.ReportStatistics.mapper.ReportStatisticsTaskMapper;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.time.LocalDate;


/**
 * 每日上报统计定时任务
 *
 * @author chenbai
 * @version 1.0
 * @date 2022/1/7 15:59
 */
@Component
public class ReportStatisticsTask {

    @Resource
    private ReportStatisticsTaskMapper mapper;

    public void calculate() {
        try {
            LocalDate now = LocalDate.now();
            LocalDate beforeDay = now.minusDays(1);
            mapper.calculate(beforeDay);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
